﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeBehind="Modify.aspx.cs" Inherits="Travel.Web.route.Modify" Title="增加页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style>
        #tabs-3 td, #tabs-3 th
        {
            border-left: 1px solid #999;
            border-bottom: 1px solid #999;
            width: 120px;
            padding: 10px 0;
            text-align: center;
        }
        #tabs-3 table
        {
            border-right: 1px solid #999;
            border-top: 1px solid #999;
        }
        #tabs-3 th
        {
            background: #666;
            color: #fff;
        }
        .other-month
        {
            background: #eee;
        }
    </style>
    <link href="../../scripts/jquery.uploadify-v2.1.0/uploadify.css" rel="stylesheet"
        type="text/css" />
    <script type="text/javascript">
        window.UEDITOR_HOME_URL = "http://" + window.location.host + '/ueditor/';
    </script>
    <script src="../../scripts/jquery-1.9.0.js" type="text/javascript"></script>
    <script src="../../scripts/jquery-ui.js" type="text/javascript"></script>
    <script src="../../scripts/jquery.tmpl.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../ueditor/editor_all.js"></script>
    <script type="text/javascript" src="../../ueditor/editor_config.js"></script>
    <script type="text/javascript" src="../../scripts/jquery.uploadify-v2.1.0/jquery.uploadify.min.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">线路基本信息</a></li>
            <li><a href="#tabs-2">线路焦点图</a></li>
            <li><a href="#tabs-3">线路价格设置</a></li>
            <li><a href="#tabs-4">线路说明</a></li>
        </ul>
        <div id="tabs-1">
            <table style="width: 100%;" cellpadding="2" cellspacing="1" class="border">
                <tr>
                    <td class="tdbg">
                        <table cellspacing="0" cellpadding="0" width="100%" border="0">
                            <tr>
                                <td height="25" width="30%" align="right">
                                    线路名称 ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtname" runat="server" Width="200px"></asp:TextBox>
                                    <asp:HiddenField runat="server" ID="txtId" Value=""></asp:HiddenField>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    线路类型
                                </td>
                                <td height="25" width="*" align="left">
                                    <select  runat="server"  ID="txttype">
                                        <option title="国内" value="1">国内</option>
                                        <option title="国外" value="2">国外</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    关键字 用于搜索 ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtkey_words" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    出发地 ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtstart_with" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    目的地 ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtend_with" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    出发地Id ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtstart_id" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    目的地id ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtend_id" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    天数 ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtdays_account" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" width="30%" align="right">
                                    出发日期 ：
                                </td>
                                <td height="25" width="*" align="left">
                                    <asp:TextBox ID="txtbegin_date" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div id="tabs-2">
            <input type="file" name="uploadify" id="uploadify" />
            <br />
            <div id="fileQueue">
            </div>
            <table id="imageList" style="width: 100%; border: 1px;">
                <thead>
                    <tr>
                        <td>
                            路径
                        </td>
                        <td>
                            标题
                        </td>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
        <div id="tabs-3">
            线路价格
            <table id="routePriceList">
                <thead>
                    <tr>
                        <td>
                            日期
                        </td>
                        <td>
                            总人数
                        </td>
                        <td>
                            价格
                        </td>
                        <td>
                            已售人数
                        </td>
                        <td>
                            操作
                        </td>
                    </tr>
                </thead>
                <tbody>
                </tbody>
                <tfoot>
                    <tr>
                        <td>
                            <input type="text" id="benginDate" />
                        </td>
                        <td>
                            <input type="text" id="totalNumbers" />
                        </td>
                        <td>
                            成人价：
                            <input type="text" id="audltPrice" /><br />
                            儿童价:
                            <input type="text" id="childrenPrice" />
                        </td>
                        <td>
                            <input type="text" id="salesNumber" />
                        </td>
                        <td>
                            <button type="button" id="addPrice" style="width: 80px; height: 20px">
                                添加</button>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </div>
        <div id="tabs-4">
            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                <tr>
                    <td height="25" width="30%" align="right">
                        行程特色 ：
                    </td>
                    <td height="25" width="*">
                        <div>
                            <asp:TextBox runat="server" ID="editor_txtfeature" TextMode="MultiLine"></asp:TextBox>
                            <%--<DNTB:WebEditor ID="editor_txtfeature" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                                Width="600px"></DNTB:WebEditor>--%>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        行程包含 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_txtroute_contains" TextMode="MultiLine"></asp:TextBox>
                        <%--  <DNTB:WebEditor ID="editor_txtroute_contains" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        行程不包含 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_txtroute_not_contains" TextMode="MultiLine"></asp:TextBox>
                        <%--   <DNTB:WebEditor ID="editor_txtroute_not_contains" runat="server" Skin="skin/xp/"
                            MenuConfig="all.config" Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        自费项目 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_txtown_expense" TextMode="MultiLine"></asp:TextBox>
                        <%--  <DNTB:WebEditor ID="editor_txtown_expense" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        购物场所 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_txtshopping_area" TextMode="MultiLine"></asp:TextBox>
                        <%--<DNTB:WebEditor ID="editor_txtshopping_area" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        服务标准 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_txtservice" TextMode="MultiLine"></asp:TextBox>
                        <%--<DNTB:WebEditor ID="editor_txtservice" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        友情提醒 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_txtfriend" TextMode="MultiLine"></asp:TextBox>
                        <%--<DNTB:WebEditor ID="editor_txtfriend" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        签证须知 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="editor_notice" TextMode="MultiLine"></asp:TextBox>
                        <%--<DNTB:WebEditor ID="editor_notice" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
                <tr>
                    <td height="25" width="30%" align="right">
                        线路说明 ：
                    </td>
                    <td height="25" width="*" align="left">
                        <asp:TextBox runat="server" ID="edtor_content" TextMode="MultiLine"></asp:TextBox>
                        <%=edtor_content.ClientID %>
                        <%-- <DNTB:WebEditor ID="edtor_content" runat="server" Skin="skin/xp/" MenuConfig="all.config"
                            Width="600px"></DNTB:WebEditor>--%>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <asp:Button ID="Button3" runat="server" Text="保存" OnClick="btnSave_Click" class="inputbutton"
        onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'">
    </asp:Button>
    <asp:Button ID="Button4" runat="server" Text="取消" OnClick="btnCancle_Click" class="inputbutton"
        onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'">
    </asp:Button>
    <br />
    <script type="text/x-jquery-tmpl" id="routePriceTmpl">
        <tr>
            <td>
                <input type="text" isBeginDate="true" value="${beginDate}" />
            </td>
            <td>
                <input type="text" isTotalNumbers="true" value="${totalNumbers}" />
            </td>
            <td>
                成人价：
                <input type="text" isAdultPrice="true" value="${adultPrice}"/><br />
                儿童价:
                <input type="text" isChildrenPrice="true"  value="${childrenPrice}" />
            </td>
            <td>
                <input type="text" isSalesNumbers="true" value="${saleNumbers}" />
            </td>
            <td>
                <button type="button" isRemove="true" style="width: 80px;height: 20px">
                    删除</button>
            </td>
        </tr>
    </script>
    <script type="text/x-jquery-tmpl" id="imageTmpl">
        <tr>
            <td>
                <input type="text" isUrl="true" value="${url}" />
            </td>
            <td>
                <input type="text" isTitle="true" value="${title}" />
            </td>           
            <td>
            <button type="button" isSave="true" style="width: 50px;height: 30px">
                    保存</button>
                <button type="button" isRemove="true" style="width:50px;height: 30px">
                    删除</button>
            </td>
        </tr>
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            if ($('#<%=txtId.ClientID %>').val().length > 0) {
                $("#tabs").tabs();

            } else {
                $("#tabs").tabs({ disabled: [1, 2] });
            }

            UE.getEditor('<%=edtor_content.ClientID %>');
            UE.getEditor('<%=editor_notice.ClientID %>');
            UE.getEditor('<%=editor_txtfriend.ClientID %>');
            UE.getEditor('<%=editor_txtfeature.ClientID %>');
            UE.getEditor('<%=editor_txtroute_contains.ClientID %>');
            UE.getEditor('<%=editor_txtroute_not_contains.ClientID %>');
            UE.getEditor('<%=editor_txtown_expense.ClientID %>');
            UE.getEditor('<%=editor_txtshopping_area.ClientID %>');
            UE.getEditor('<%=editor_txtservice.ClientID %>');

            var routePriceModel = {
                adultPrice: 0,
                childrenPrice: 0,
                totalNumbers: 0,
                saleNumbers: 0,
                beginDate: ''
            };
            var imageModel = {
                url: '',
                title: ''
            };

            $('#addPrice').on('click', function () {
                routePriceModel.beginDate = $('#benginDate').val();
                routePriceModel.adultPrice = $('#audltPrice').val();
                routePriceModel.childrenPrice = $('#childrenPrice').val();
                routePriceModel.saleNumbers = $('#salesNumber').val();
                routePriceModel.totalNumbers = $('#totalNumbers').val();
                $('#routePriceTmpl').tmpl(routePriceModel).appendTo('#routePriceList');

                $('input[isBeginDate="true"]').datepicker({
                    dateFormat: 'yy-mm-dd'
                });
            });

            $("#benginDate").datepicker({
                dateFormat: 'yy-mm-dd'
            });
            //jquery 1.9+ removed live
            $('#routePriceList>tbody').on("click", 'button[isRemove="true"]', function () {
                $(this).parent().parent().remove();
            });
            $('#imageList>tbody').on("click", 'button[isRemove="true"]', function () {
                $(this).parent().parent().remove();
            });

            $("#uploadify").uploadify({
                height: 30,
                swf: '../../scripts/jquery.uploadify-v2.1.0/uploadify.swf',
                uploader: '../../ashx/UploadHandler.ashx',
                width: 120,
                'onUploadComplete': function (file, data, response) {
                    imageModel.url = "upload/" + file.name;
                    imageModel.title = file.name;
                    $('#imageTmpl').tmpl(imageModel).appendTo('#imageList>tbody');
                }
            });


            $('#imageList>tbody').on("click", 'button[isSave="true"]', function () {
                $.ajax({
                    type:'post',
                    url:'../../ashx/'
                })
            });
        }); 
    </script>
</asp:Content>
<%--<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceCheckright" runat="server">
</asp:Content>--%>
